package nc.tb.ufo.re;

import nc.tb.cube.cell.InnerCell;
import nc.tb.pub.DataType;
import nc.tb.pub.util.NtbLogger;
import nc.tb.ufo.type.TypeFactory;
import nc.tb.ufore.conf.IConfigableType;


public class RenderManager {
	public static com.ufsoft.ntb.table.re.SheetCellRenderer getInnerCellRender(InnerCell ic){
		DataType cdt = ic == null?null:ic.getCellDataType();
		if(cdt == null)
			return new MutiLineInnerCellRenderer();
		
		if (cdt.getType() != DataType.ConfigableType) {
			return new MutiLineInnerCellRenderer();
		}else{
			try{
				String strConfTypeClass = cdt.getTypeName();
				IConfigableType aType = (IConfigableType) Class.forName(strConfTypeClass).newInstance();
				IConfigableTypeUI aUIType = TypeFactory.getTypeUI4Type(aType);
				return aUIType.getRenderComp();
			}catch(Exception ex){
				NtbLogger.error(ex);
			}
			return new MutiLineInnerCellRenderer();
		}
	}
}
